package cn.hipac.mall.after;

import lombok.Getter;

import java.util.Date;

public class GetterLazyExample {
    @Getter(lazy=true) private final double[] cached = expensive();

    private double[] expensive() {
        System.out.println("begin time：" + new Date().getTime());
        double[] result = new double[1000000];
        for (int i = 0; i < result.length; i++) {
            result[i] = Math.asin(i);
        }
        System.out.println("end time: " + new Date().getTime());
        return result;
    }
}
